	<? if ($this->showEmail): ?>
    <div class="control-group"> 
      <label class="control-label">Email</label>
      <div class="controls">
    	<input type="text" name="email" id="email" required>
      </div>
    </div>

    <div class="control-group"> 
      <label class="control-label">Password</label>
      <div class="controls">
    	<input type="password" name="password" id="password" required>
      </div>
    </div>
    
	<div class="control-group"> 
      <label class="control-label">Retype password</label>
      <div class="controls">
    	<input type="password" name="password2" id="password2" required>
      </div>
    </div>
	<? endif; ?>

   <div class="control-group"> 
     <label class="control-label">Address</label>
     <div class="controls">
       <textarea name="address"><?= $this->escape($this->formData['address']) ?></textarea>
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">City</label>
     <div class="controls">
       <input type="text" name="city" required value="<?= $this->escape($this->formData['city']) ?>">
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Postcode</label>
     <div class="controls">
       <input type="text" name="postcode" required value="<?= $this->escape($this->formData['postcode']) ?>">
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Owner/Dealer principal</label>
     <div class="controls">
       <input type="text" name="owner_principal" required value="<?= $this->escape($this->formData['owner_principal']) ?>">
     </div>
   </div>
   <div class="control-group"> 
     <label class="control-label">1st Contact</label>
     <div class="controls">
       <input type="text" name="contact1" required value="<?= $this->escape($this->formData['contact1']) ?>">
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">2nd Contact</label>
     <div class="controls">
       <input type="text" name="contact2" required value="<?= $this->escape($this->formData['contact2']) ?>">
     </div>
   </div>
   <div class="control-group"> 
     <label class="control-label">Telephone</label>
     <div class="controls">
       <input type="text" name="telephone" required value="<?= $this->escape($this->formData['telephone']) ?>">
     </div>
   </div>
   <div class="control-group"> 
     <label class="control-label">Mobile</label>
     <div class="controls">
       <input type="text" name="mobile" required value="<?= $this->escape($this->formData['mobile']) ?>">
     </div>
   </div>
   <div class="control-group"> 
     <label class="control-label">Website (optional)</label>
     <div class="controls">
       <input type="text" name="website" value="<?= $this->escape($this->formData['website']) ?>">
     </div>
   </div>
   <div class="control-group"> 
     <label class="control-label">How did you hear about us?</label>
     <div class="controls">
       <input type="text" name="how_did_you_hear" required value="<?= $this->escape($this->formData['how_did_you_hear']) ?>">
     </div>
   </div>

<?
  $businnessType = array('Franchised Dealer', 'Independend Car Dealer', 'Finance Company', 'Caravan Dealer',
  						 'LCV Dealer', 'Specialist Dealer', 'Group Buyer', 'Leasing Company', 'Motorbike Dealer', 'General Used Dealer', 
						 'Underwriter/Trade Cash Buyer', 'Motorhome Dealer' , 'Classic Car Dealer', 'Other...');
  $cols = 3;
  $span = 3;

  $separateRows = array();
  for ($i = 1; $i < $cols; $i++)
    $separateRows[(count($businnessType)/$cols) * $i] = true;
?>
<br>
   <label>Your type of business</label>
   <div class="row"> 
     <div class="span<?= $span ?>">
       <? foreach ($businnessType as $counter => $bType): ?>
        <label class="radio"><input type="radio" name="business_type" value="<?= $bType ?>" <? if ( $this->formData['business_type'] == $bType  || ( !$this->formData['business_type'] && $bType == 'Other...') ) : ?> checked <? endif; ?>> <?= $bType ?></label>
	     <? if ($separateRows[$counter]): ?>
	 </div>
	 <div class="span<?= $span ?>">
	     <? endif; ?>
	   <? endforeach ?>
	 </div>
   </div>
<br>
<?
  $cols = 4;
  $span = 3;

  $separateRows = array();
  for ($i = 1; $i < $cols; $i++)
    $separateRows[(count($this->brandsList)/$cols) * $i] = true;
?>
   <label>Make of vehicle that you buy:
	  <input type="button" class="btn btn-mini" value="Check All" onClick="$('.brand').attr('checked', 'checked');">
   </label>


   <div class="row"> 
     <div class="span<?= $span ?>">
       <? foreach ($this->brandsList as $counter => $brandRow): ?>
        <label class="checkbox"><input type="checkbox" class="brand" name="brands[<?= trim($brandRow->name) ?>]" <?= (isset($this->formData['brands'][trim($brandRow->name)]))?'checked=checked':'' ?>> <?= $brandRow->name ?></label>
	     <? if ($separateRows[$counter]): ?>
	 </div>
     <div class="span<?= $span ?>">
	     <? endif; ?>
	   <? endforeach ?>
	 </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Cars Aged from</label>
     <div class="controls">
       <input type="number" name="cars_aged_from" required value="<?= ($this->formData['cars_aged_from'])?$this->formData['cars_aged_from']:(date("Y")-40) ?>">
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Cars Aged to</label>
     <div class="controls">
       <input type="number" name="cars_aged_to" required value="<?= ($this->formData['cars_aged_to'])?$this->formData['cars_aged_to']:date("Y") ?>">
     </div>
   </div>
   
   <div class="control-group"> 
     <label class="control-label">Vehicle body types</label>
     <div class="controls">
       <? foreach (array("Estate", "People Carrier", "4WD", "Coupe", "Convertible", "Saloon") as $type): ?>
	     <label class="checkbox">
	       <input type="checkbox" value="<?= $type ?>" name="body_types[]" <?= (isset($this->formData['body_types'][$type]))?'checked=checked':'' ?>><?= $type ?>
	     </label>
       <? endforeach; ?>
     </div>
   </div>
   
   <div class="control-group"> 
     <label class="control-label">Fuel</label>
     <div class="controls">
       <? foreach (array("Petrol", "Diesel", "LPG") as $type): ?>
	     <label class="checkbox">
	       <input type="checkbox" value="<?= $type ?>" name="fuel[]" <?= (isset($this->formData['fuel'][$type]))?'checked=checked':'' ?>><?= $type ?>
	     </label>
       <? endforeach; ?>
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Transmission</label>
     <div class="controls">
       <? foreach (array("Automatic", "Manual") as $type): ?>
	     <label class="checkbox">
	       <input type="checkbox" value="<?= $type ?>" name="transmission[]" <?= (isset($this->formData['transmission'][$type]))?'checked=checked':'' ?>><?= $type ?>
	     </label>
       <? endforeach; ?>
     </div>
   </div>

   <div class="control-group"> 
     <label class="control-label">Cars from</label>
     <div class="controls">
       <? foreach (array(15 => "15 miles", /*, 20 => "20 miles", 30 => "30 miles", 40 => "40 miles", 50 => "50 miles", 60 => "60 miles", */99999 => "Nationwide") as $vType => $type): ?>
	     <label class="radio">
	       <input type="radio" value="<?= $vType ?>" name="cars_from" <?= ($this->formData['cars_from'] == $vType)?'checked=checked':'' ?>><?= $type ?>

	     </label>
       <? endforeach; ?>
     </div>
   </div>
